<template>
  <div class="app-container">
    <el-card class="box-card">
      <el-form :inline="true" :model="listQuery">
        <el-form-item label="">
          <el-select
            size="small"
            v-model="listQuery.case_type"
            placeholder="案件类型"
            clearable
          >
            <el-option
              v-for="item in case_types"
              :label="item.name"
              :value="item.id"
              :key="item.id"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item>
          <el-input
            size="small"
            style="min-width: 210px"
            v-model="listQuery.name"
            placeholder="律师/收案人/委托人/当事人"
            clearable
            @keyup.enter.native="handleFilter"
          >
          </el-input>
        </el-form-item>
        <el-form-item>
          <el-input
            size="small"
            style="min-width: 210px"
            v-model="listQuery.reason"
            placeholder="案由"
            clearable
            @keyup.enter.native="handleFilter"
          >
          </el-input>
        </el-form-item>
        <el-form-item>
          <el-date-picker
            size="small"
            v-model="listQuery.search_date"
            type="daterange"
            align="right"
            unlink-panels
            range-separator="至"
            start-placeholder="开始日期"
            end-placeholder="结束日期"
            :picker-options="pickerOptions"
            format="yyyy-MM-dd"
            value-format="yyyy-MM-dd"
          >
          </el-date-picker>
        </el-form-item>
        <el-form-item>
          <el-button
            type="primary"
            size="mini"
            icon="el-icon-search"
            @click.native="handleFilter"
            >查询</el-button
          >
        </el-form-item>
        <el-form-item>
          <el-button
            type="primary"
            icon="el-icon-plus"
            size="mini"
            @click="handleSearch"
            >新增{{ this.title }}</el-button
          >
        </el-form-item>
      </el-form>
      <el-table
        :data="cases"
        border
        v-loading="listLoading"
        fit
        highlight-current-row
        style="width: 100%"
        size="small"
      >
        <el-table-column type="expand" align="center">
          <template slot-scope="scope">
            <el-table
              :data="scope.row.letters"
              border
              v-if="scope.row.letters.length > 0"
              size="mini"
              fit
              highlight-current-row
              style="width: 100%"
            >
              <el-table-column align="center" label="律所函编号" prop="code" />
              <!-- <el-table-column align="center" label="委托人" prop="client" /> -->
              <el-table-column align="center" label="当事人" prop="party" />
              <el-table-column align="center" label="针对机关" prop="court" />
              <el-table-column align="center" label="案由/罪名" prop="reason" />
              <el-table-column align="center" label="律师" prop="lawyer" />
              <el-table-column
                align="center"
                label="盖章时间"
                prop="stamp_time"
                :formatter="dataFormatter"
              />
              <el-table-column align="center" label="操作">
                <template slot-scope="scope">
                  <el-button
                    type="warning"
                    size="mini"
                    icon="el-icon-printer"
                    @click="handlePrint(scope.row)"
                    v-if="scope.row.apply_confirm == true"
                    >打印</el-button
                  >
                </template>
              </el-table-column>
            </el-table>
            <el-table
              :data="scope.row.introduces"
              border
              fit
              v-if="scope.row.introduces.length > 0"
              size="mini"
              style="width: 100%"
            >
              <el-table-column align="center" label="介绍信编号" prop="code" />
              <el-table-column align="center" label="看守所" prop="court" />
              <el-table-column align="center" label="律师" prop="lawyer" />
              <el-table-column align="center" label="当事人" prop="party" />
              <el-table-column align="center" label="罪名" prop="reason" />
              <el-table-column
                align="center"
                label="盖章时间"
                prop="stamp_time"
                :formatter="dataFormatter"
              />
              <el-table-column align="center" label="操作">
                <template slot-scope="scope">
                  <el-button
                    type="warning"
                    size="mini"
                    icon="el-icon-printer"
                    @click="handlePrint(scope.row)"
                    v-if="scope.row.apply_confirm == true"
                    >打印</el-button
                  >
                </template>
              </el-table-column>
            </el-table>
          </template>
        </el-table-column>
        <el-table-column
          type="index"
          label="#"
          align="center"
        ></el-table-column>
        <el-table-column
          v-for="column in tableColumns"
          :key="column.key"
          :label="column.title"
          :prop="column.key"
          :align="column.align ? column.width : 'center'"
          :width="column.width ? column.width : ''"
        >
          <template slot-scope="scope">
            <div v-if="column.key == 'current_phase'">
              <el-link
                v-if="scope.row[column.key].length > 0"
                @click="handleProgress(scope.row)"
                type="primary"
                icon="el-icon-edit-outline"
                >{{ scope.row[column.key] }}</el-link
              >
              <el-link
                v-else
                @click="handleProgress(scope.row)"
                type="danger"
                icon="el-icon-edit-outline"
                >增加进度</el-link
              >
            </div>
            <div v-else-if="column.key == 'open_time'">
              <span
                :style="[
                  { color: scope.row.warning == 1 ? 'red' : '' },
                  { fontWeight: scope.row.warning == 1 ? 'bold' : 'normal' },
                ]"
                >{{ scope.row[column.key] }}</span
              >
            </div>
            <div v-else>
              <span>{{ scope.row[column.key] }}</span>
            </div>
          </template>
        </el-table-column>
        <el-table-column
          align="center"
          label="操作"
          :width="is_super ? '290px' : '240px'"
        >
          <template slot-scope="scope">
            <el-button
              type="primary"
              size="mini"
              icon="el-icon-edit"
              @click="handleEdit(scope, 'edit')"
              v-if="scope.row.archive_flag == false"
              >编辑</el-button
            >
            <el-button
              type="success"
              size="mini"
              icon="el-icon-search"
              @click="handleEdit(scope, 'detail')"
              v-else
              >查看</el-button
            >
            <el-button
              type="danger"
              size="mini"
              icon="el-icon-delete"
              v-if="is_super"
              @click="handleDelete(scope)"
              >删除</el-button
            >
            <el-dropdown @command="handleCommand">
              <el-button type="success" size="mini">
                更多功能<i class="el-icon-arrow-down el-icon--right"></i>
              </el-button>
              <el-dropdown-menu slot="dropdown">
                <el-dropdown-item
                  icon="el-icon-plus"
                  :command="{ type: 'letter', row: scope.row }"
                  >律所函</el-dropdown-item
                >
                <el-dropdown-item
                  v-if="scope.row.case_type === 2"
                  icon="el-icon-plus"
                  :command="{ type: 'introduce', row: scope.row }"
                  >介绍信</el-dropdown-item
                >
              </el-dropdown-menu>
            </el-dropdown>
          </template>
        </el-table-column>
      </el-table>
      <!-- 分页 -->
      <pagination
        v-show="total > 0"
        :total="total"
        :page.sync="listQuery.page"
        :limit.sync="listQuery.page_size"
        @pagination="getCaseList"
      />
    </el-card>
    <!-- 案件查询 -->
    <el-dialog :visible.sync="dlgSearchVisible" title="案件查询" width="800px">
      <el-form
        :model="searchForm"
        ref="searchFormRef"
        :rules="searchFormRules"
        label-width="100px"
        label-position="right"
        style="width: 95%; padding: 0 30px"
        status-icon
      >
        <el-alert
          title="增加案件时,请先确定对方当事人的案件是否已经在本所登记"
          type="warning"
          effect="dark"
          show-icon
          :closable="false"
          center
          style="margin-bottom: 10px"
        >
        </el-alert>
        <el-form-item label="当事人" prop="party">
          <el-input
            type="text"
            v-model="searchForm.party"
            placeholder="当事人"
            clearable
          />
        </el-form-item>
        <el-form-item label="对方当事人" prop="oppo_party">
          <el-input
            type="text"
            v-model="searchForm.oppo_party"
            placeholder="对方当事人"
            clearable
          />
        </el-form-item>
      </el-form>
      <el-table :data="caseDatas" size="mini" border>
        <el-table-column
          label="#"
          type="index"
          align="center"
        ></el-table-column>
        <el-table-column
          label="当事人"
          prop="party"
          align="center"
        ></el-table-column>
        <el-table-column
          label="对方当事人"
          prop="oppo_party"
          align="left"
        ></el-table-column>
        <el-table-column
          label="主办律师"
          prop="lead_lawyer_name"
          align="left"
        ></el-table-column>

        <el-table-column
          label="案由"
          prop="reason"
          align="left"
        ></el-table-column>
      </el-table>
      <div slot="footer">
        <el-button type="default" size="small" @click="dlgSearchVisible = false"
          >返回</el-button
        >
        <el-button type="primary" size="small" @click="onHandleSearch"
          >查询</el-button
        >
        <el-button
          type="success"
          size="small"
          @click="handleAdd"
          :disabled="search"
          >增加案件</el-button
        >
      </div>
    </el-dialog>
    <!-- 案件登记 -->
    <el-dialog
      :visible.sync="dialogVisible"
      :title="getTitle"
      width="800px"
      destroy-on-close
      @close="handleClose"
      @open="handleOpen"
    >
      <el-form
        :model="form"
        :rules="formRules"
        ref="formRef"
        label-width="100px"
        label-position="right"
        style="width: 95%; padding: 0 30px"
        status-icon
        size="small"
      >
        <el-row>
          <el-col :span="12">
            <el-form-item label="案件类型" prop="case_type">
              <el-select
                v-model="form.case_type"
                placeholder="案件类型"
                clearable
                @change="caseTypeChange"
                :disabled="form.user != null && form.user != uid"
              >
                <el-option
                  v-for="item in case_types"
                  :label="item.name"
                  :value="item.id"
                  :key="item.id"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="存档编号" prop="code">
              <el-input
                type="text"
                v-model="form.code"
                placeholder="存档编号"
                disabled
              />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="委托人" prop="client">
              <el-input
                type="text"
                v-model="form.client"
                placeholder="委托人"
                clearable
                :disabled="form.user != null && form.user != uid"
              />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="电话" prop="telephone">
              <el-input
                v-model="form.telephone"
                placeholder="电话"
                clearable
                :disabled="form.user != null && form.user != uid"
              />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item
              :label="form.case_type == 2 ? '犯罪嫌疑人' : '当事人'"
              prop="party"
            >
              <el-input
                v-model="form.party"
                :placeholder="form.case_type == 2 ? '犯罪嫌疑人' : '当事人'"
                clearable
                :disabled="form.user != null && form.user != uid"
              />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="收案人" prop="recv_lawyer">
              <el-input
                v-model="form.recv_lawyer"
                placeholder="收案人"
                clearable
                :disabled="form.user != null && form.user != uid"
              />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="主办律师" prop="lead_lawyer">
              <el-select
                v-model="form.lead_lawyer"
                placeholder="主办律师"
                clearable
                :disabled="form.user != null && form.user != uid"
              >
                <el-option
                  v-for="user in users"
                  :label="user.real_name"
                  :value="user.id"
                  :key="user.id"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="出庭律师1" prop="assist_lawyer">
              <el-select
                v-model="form.assist_lawyer"
                placeholder="出庭律师"
                clearable
                :disabled="form.user != null && form.user != uid"
              >
                <el-option
                  v-for="user in users"
                  :label="user.real_name"
                  :value="user.id"
                  :key="user.id"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="出庭律师2" prop="third_lawyer">
              <el-select
                v-model="form.third_lawyer"
                placeholder="出庭律师"
                clearable
                :disabled="form.user != null && form.user != uid"
              >
                <el-option
                  v-for="user in users"
                  :label="user.real_name"
                  :value="user.id"
                  :key="user.id"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <el-form-item
              label="对方当事人"
              prop="oppo_party"
              v-if="form.case_type != 2"
              :required="form.archive_flag == true ? true : false"
              :rules="form.archive_flag == true ? formRules.oppo_party : []"
            >
              <el-input
                v-model="form.oppo_party"
                placeholder="对方当事人"
                clearable
              />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <el-form-item
              v-if="form.case_type == 2 || form.case_type == 5"
              label="罪 名"
              prop="reason"
              :required="form.archive_flag == true ? true : false"
              :rules="form.archive_flag == true ? formRules.reason : []"
            >
              <el-input v-model="form.reason" placeholder="罪名" clearable />
            </el-form-item>
            <el-form-item
              v-else
              label="案 由"
              prop="reason"
              :required="form.archive_flag == true ? true : false"
              :rules="form.archive_flag == true ? formRules.reason : []"
            >
              <el-autocomplete
                v-model="form.reason"
                :fetch-suggestions="querySearch"
                placeholder="请输入内容"
                @select="handleSelect"
              ></el-autocomplete>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item
              label="管辖法院"
              prop="court"
              :required="form.archive_flag == true ? true : false"
              :rules="form.archive_flag == true ? formRules.court : []"
            >
              <el-input v-model="form.court" placeholder="管辖法院" clearable />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item
              label="审 级"
              prop="level"
              :required="form.archive_flag == true ? true : false"
              :rules="form.archive_flag == true ? formRules.level : []"
            >
              <el-input v-model="form.level" placeholder="审级" clearable />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item
              label="立案时间"
              prop="register_time"
              v-if="form.case_type != 2"
              :required="form.archive_flag == true ? true : false"
              :rules="form.archive_flag == true ? formRules.register_time : []"
            >
              <el-date-picker
                v-model="form.register_time"
                type="date"
                placeholder="立案时间"
                value-format="yyyy-MM-dd"
              >
              </el-date-picker>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item
              label="开庭时间"
              prop="open_time"
              :required="form.archive_flag == true ? true : false"
              :rules="form.archive_flag == true ? formRules.open_time : []"
            >
              <el-date-picker
                v-model="form.open_time"
                type="date"
                placeholder="开庭时间"
                value-format="yyyy-MM-dd"
              >
              </el-date-picker>
            </el-form-item>
          </el-col>
        </el-row>

        <el-row>
          <el-col :span="12">
            <el-form-item
              label="结案时间"
              prop="end_time"
              :required="form.archive_flag == true ? true : false"
              :rules="form.archive_flag == true ? formRules.end_time : []"
            >
              <el-date-picker
                v-model="form.end_time"
                type="date"
                placeholder="结案时间"
                value-format="yyyy-MM-dd"
              >
              </el-date-picker>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item
              label="案号"
              prop="case_num"
              :required="form.archive_flag == true ? true : false"
              :rules="form.archive_flag == true ? formRules.case_num : []"
            >
              <el-input v-model="form.case_num" placeholder="案号" clearable />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row v-if="form.id != null">
          <el-col :span="24">
            <el-form-item label="案件资料">
              <el-upload
                ref="upload"
                action="/api/case/file_upload/"
                multiple
                :on-preview="handlePreview"
                :before-upload="handleBeforeUpload"
                :on-remove="handleRemove"
                :on-success="handleSuccess"
                :file-list="fileList"
                :auto-upload="false"
                accept=".pdf,.doc,.docx,.xls,.xlsx,.rar,.zip,.PDF,.DOC,.DOCX,.XLS,.XLSX,.RAR,.ZIP"
                :headers="headerObj"
                :data="uploadData"
                :disabled="form.id == null || form.archive_flag == true"
              >
                <div v-if="form.archive_flag != true">
                  <el-button slot="trigger" size="small" type="primary"
                    >选取文件</el-button
                  >
                  <el-button
                    style="margin-left: 10px"
                    size="small"
                    type="success"
                    @click="submitUpload"
                    >上传到服务器</el-button
                  >
                </div>
              </el-upload>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <el-form-item
              label="归档"
              prop="archive_flag"
              v-if="dialogType == 'edit'"
            >
              <el-switch
                v-model="form.archive_flag"
                @change="handleArchive"
              ></el-switch>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <div slot="footer">
        <el-button type="danger" @click="dialogVisible = false">取消</el-button>
        <el-button
          type="primary"
          @click="handleSave(false)"
          v-if="dialogType != 'detail'"
          >保存</el-button
        >
        <!-- <el-button
          type="primary"
          v-if="dialogType == 'new'"
          @click="handleSave(true)"
          >保存并新增</el-button
        > -->
      </div>
    </el-dialog>
    <!-- 律所函 -->
    <el-dialog
      :visible.sync="dlgLetterVisible"
      title="新增律所函"
      width="800px"
    >
      <el-form
        :model="letterForm"
        :rules="letterFormRules"
        ref="letterFormRef"
        label-width="100px"
        label-position="right"
        style="width: 95%; padding: 0 30px"
        status-icon
      >
        <el-row>
          <el-col :span="12">
            <el-form-item label="案件编号" prop="case_code">
              <el-input
                type="text"
                v-model="letterForm.case_code"
                placeholder="案件编号"
                disabled
              />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="律所函编号" prop="code">
              <el-input
                type="text"
                v-model="letterForm.code"
                placeholder="律所函编号"
                disabled
              />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="委托人" prop="client">
              <el-input
                type="text"
                v-model="letterForm.client"
                placeholder="委托人"
                clearable
                disabled
              />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="当事人" prop="party">
              <el-input
                v-model="letterForm.party"
                placeholder="当事人"
                clearable
                disabled
              />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <el-form-item
              v-if="letterForm.case_type == 2 || letterForm.case_type == 5"
              label="罪名"
              prop="reason"
            >
              <el-input
                v-model="letterForm.reason"
                placeholder="罪名"
                clearable
                disabled
              />
            </el-form-item>
            <el-form-item v-else label="案由" prop="reason">
              <el-input
                v-model="letterForm.reason"
                placeholder="案由"
                clearable
                disabled
              />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="审级" prop="level">
              <el-input
                v-model="letterForm.level"
                placeholder="审级"
                disabled
              ></el-input>
            </el-form-item>
          </el-col>

          <el-col :span="12">
            <el-form-item label="律师" prop="lawyer">
              <el-input
                v-model="letterForm.lawyer"
                placeholder="律师"
                clearable
              />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="针对机关" prop="court">
              <el-input
                v-model="letterForm.court"
                placeholder="法院/检察院/看守所等"
                clearable
              />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="申请确认" prop="apply_confirm">
              <el-radio-group v-model="letterForm.apply_confirm">
                <el-radio :label="true">确定</el-radio>
                <el-radio :label="false">暂不</el-radio>
              </el-radio-group>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <div slot="footer">
        <el-button type="danger" @click="dlgLetterVisible = false"
          >取消</el-button
        >
        <el-button type="primary" @click="handleSaveLetter()">保存</el-button>
        <el-button type="primary" @click="handleSaveLetter('print')"
          >保存并打印</el-button
        >
      </div>
    </el-dialog>
    <!-- 介绍信 -->
    <el-dialog :visible.sync="dlgIntroVisible" title="新增介绍信" width="800px">
      <el-form
        :model="introForm"
        :rules="introFormRules"
        ref="introFormRef"
        label-width="100px"
        label-position="right"
        style="width: 95%; padding: 0 30px"
        status-icon
      >
        <el-row>
          <el-col :span="12">
            <el-form-item label="案件编号" prop="case_code">
              <el-input
                type="text"
                v-model="introForm.case_code"
                placeholder="案件编号"
                disabled
              />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="介绍信编号" prop="code">
              <el-input
                type="text"
                v-model="introForm.code"
                placeholder="律所函编号"
                disabled
              />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="看守所" prop="court">
              <el-input
                v-model="introForm.court"
                placeholder="看守所"
                clearable
              />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="律师" prop="lawyer">
              <el-input
                v-model="introForm.lawyer"
                placeholder="律师"
                clearable
                @change="handleChange"
                @clear="handleClear"
              />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <el-form-item label="执业证号" prop="cert_no">
              <el-input
                v-model="introForm.cert_no"
                placeholder="执业证号"
                clearable
              />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <el-form-item label="身份证号" prop="id_card">
              <el-input
                v-model="introForm.id_card"
                placeholder="身份证号"
                clearable
              />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <el-form-item label="联系电话" prop="telephone">
              <el-input
                v-model="introForm.telephone"
                placeholder="联系电话"
                clearable
              />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <el-form-item label="罪名" prop="reason">
              <el-input
                v-model="introForm.reason"
                placeholder="罪名"
                clearable
                disabled
              />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="当事人" prop="party">
              <el-input
                v-model="introForm.party"
                placeholder="当事人"
                clearable
                disabled
              />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="申请确认" prop="apply_confirm">
              <el-radio-group
                v-model="introForm.apply_confirm"
                :disabled="
                  introForm.apply_confirm == true &&
                  dialogType != 'new' &&
                  introForm.code != ''
                "
              >
                <el-radio :label="true">确定</el-radio>
                <el-radio :label="false">暂不</el-radio>
              </el-radio-group>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <div slot="footer">
        <el-button type="danger" @click="dlgIntroVisible = false"
          >取消</el-button
        >
        <el-button type="primary" @click="handleSaveIntro()">保存</el-button>
        <el-button type="primary" @click="handleSaveIntro('print')"
          >保存并打印</el-button
        >
      </div>
    </el-dialog>
    <!-- 案件进度 -->
    <el-dialog
      :visible.sync="dlgProgressVisible"
      :title="'设置案件办理进度--' + case_code"
      width="900px"
      top="10"
    >
      <div style="display: flex; align-items: top">
        <el-checkbox-group
          v-model="checkProgressList"
          v-if="archive_flag != true"
        >
          <el-table
            :data="progressList"
            highlight-current-row
            row-key="id"
            border
            size="mini"
            style="width: 350px"
            max-height="500"
          >
            <el-table-column label="案件进度项列表" prop="name">
              <template slot-scope="scope">
                <el-checkbox
                  :label="scope.row.id"
                  :key="scope.row.id"
                  @change="
                    (checked) => handleProgressChange(checked, scope.row.id)
                  "
                  ><span :style="scope.row.is_final ? 'color:red' : ''">{{
                    scope.row.name
                  }}</span></el-checkbox
                >
              </template>
            </el-table-column>
          </el-table>
        </el-checkbox-group>
        <div
          style="padding: 0px; display: flex; align-items: center; width: 2px"
        ></div>
        <el-table
          :data="selProgress"
          highlight-current-row
          row-key="id"
          border
          size="mini"
          style="width: 600px"
          max-height="550"
        >
          <el-table-column
            type="index"
            label="#"
            align="center"
          ></el-table-column>
          <el-table-column label="办理进度列表" prop="progress_name" />
          <el-table-column
            align="center"
            label="是否确认"
            prop="confirm_name"
            width="80"
          >
            <!-- :disabled="uid != assist_lawyer" -->
            <template slot-scope="scope">
              <el-switch
                v-model="scope.row.confirm"
                :active-value="1"
                :inactive-value="0"
                @change="onConfirmChange(scope.row)"
              ></el-switch>
            </template>
          </el-table-column>
          <el-table-column
            label="时间"
            prop="add_time"
            align="center"
            :formatter="dataFormatter"
            width="90"
          >
          </el-table-column>
          <el-table-column
            label="操作"
            align="center"
            v-if="archive_flag != true"
            width="95"
          >
            <template slot-scope="scope">
              <el-button
                type="danger"
                size="mini"
                icon="el-icon-delete"
                @click="deleteProgress(scope)"
                >删除</el-button
              >
            </template>
          </el-table-column>
        </el-table>
      </div>

      <div slot="footer">
        <el-button type="danger" size="small" @click="onProgressClose"
          >关闭</el-button
        >
      </div>
    </el-dialog>
  </div>
</template>

<script>
import { mapGetters } from "vuex";
import {
  getCases,
  addCase,
  updateCase,
  delCase,
  addLetter,
  addIntroduce,
  getProgressList,
  addCaseProgress,
  delCaseProgress,
  updateCaseProgress,
  getAllReason,
  delCaseFile,
  getSearchCases,
} from "@/api/case";

import Transfer from "@/components/Transfer";
import { getUserList } from "@/api/user";
import { formatDateTime } from "@/utils/datetime";
import Pagination from "@/components/Pagination";
import { updateCaseLawyer } from "@/api/customer";

const defaultForm = {
  id: null,
  code: "",
  client: "",
  party: "",
  telephone: "",
  oppo_party: "",
  case_type: null,
  recv_lawyer: "",
  reason: "",
  court: "",
  level: "",
  lead_lawyer: null,
  assist_lawyer: null,
  third_lawyer: null,
  register_time: null,
  open_time: null,
  end_time: null,
  case_num: "",
  // comment: "",
  files: null,
  user: null,
  archive_flag: false,
};

const defaultLetterForm = {
  id: null,
  code: "",
  case: null,
  case_code: "",
  court: "",
  level: "",
  client: "",
  party: "",
  lawyer: null,
  reason: "",
  apply_confirm: null,
  user: null,
};

const defaultIntroForm = {
  id: null,
  code: "",
  case: null,
  case_code: "",
  court: "",
  party: "",
  lawyer: null,
  cert_no: "",
  id_card: "",
  telephone: "",
  reason: "",
  apply_confirm: null,
  user: null,
};

const defSearchForm = {
  party: null,
  oppo_party: null,
};

export default {
  name: "CaseInfo",
  data() {
    const checkReason = (rule, value, callback) => {
      if (value === "") {
        if (this.case_type == 2 || this.case_type == 5) {
          callback(new Error("请输入罪名"));
        } else {
          callback(new Error("请输入案由"));
        }
      } else {
        callback();
      }
    };

    return {
      form: Object.assign({}, defaultForm),
      letterForm: Object.assign({}, defaultLetterForm),
      introForm: Object.assign({}, defaultIntroForm),
      searchForm: Object.assign({}, defSearchForm),
      search: true,
      value: [],

      formRules: {
        case_type: [
          { required: true, message: "请选择案件类型", trigger: "blur" },
        ],
        client: [
          {
            type: "string",
            required: true,
            message: "请输入委托人",
            trigger: "blur",
          },
        ],
        telephone: [
          {
            type: "string",
            required: true,
            message: "请输入电话",
            trigger: "blur",
          },
        ],
        party: [
          {
            type: "string",
            required: true,
            message: "请输入当事人",
            trigger: "blur",
          },
        ],
        reason: [
          {
            type: "string",
            required: true,
            validator: checkReason,
            trigger: ["blur", "change"],
          },
        ],
        court: [
          {
            type: "string",
            required: true,
            message: "请输入管辖法院",
            trigger: "blur",
          },
        ],
        recv_lawyer: [
          {
            type: "string",
            required: true,
            message: "请输入收案律师",
            trigger: "blur",
          },
        ],
        level: [
          {
            type: "string",
            required: true,
            message: "请输入审级",
            trigger: "blur",
          },
        ],
        lead_lawyer: [
          {
            required: true,
            message: "请输入主办律师",
            trigger: "blur",
          },
        ],
        register_time: [
          {
            type: "string",
            required: true,
            message: "请输入立案时间",
            trigger: "blur",
          },
        ],
        open_time: [
          {
            type: "string",
            required: true,
            message: "请输入开庭时间",
            trigger: "blur",
          },
        ],
        oppo_party: [
          {
            type: "string",
            required: true,
            message: "请输入对方当事人",
            trigger: "blur",
          },
        ],
        end_time: [
          {
            type: "string",
            required: true,
            message: "请输入结案时间",
            trigger: "blur",
          },
        ],
        case_num: [
          {
            type: "string",
            message: "请输入案号",
            required: true,
            trigger: "blur",
          },
        ],
      },
      letterFormRules: {
        client: [
          {
            type: "string",
            required: true,
            message: "请输入委托人",
            trigger: "blur",
          },
        ],
        party: [
          {
            type: "string",
            required: true,
            message: "请输入当事人",
            trigger: "blur",
          },
        ],
        reason: [
          {
            type: "string",
            required: true,
            validator: checkReason,
            trigger: "blur",
          },
        ],
        court: [
          {
            type: "string",
            required: true,
            message: "请输入法院",
            trigger: "blur",
          },
        ],
        office_name: [
          {
            type: "string",
            required: true,
            message: "请输入律师",
            trigger: "blur",
          },
        ],
        lawyer: [
          {
            type: "string",
            required: true,
            message: "请输入律师",
            trigger: "blur",
          },
        ],
        level: [
          {
            type: "string",
            required: true,
            message: "请输入审级",
            trigger: "blur",
          },
        ],
        apply_confirm: [
          {
            type: "boolean",
            required: true,
            message: "请选择申请确认",
            trigger: "blur",
          },
        ],
      },
      introFormRules: {
        party: [
          {
            type: "string",
            required: true,
            message: "请输入当事人",
            trigger: "blur",
          },
        ],
        reason: [
          {
            type: "string",
            required: true,
            validator: checkReason,
            trigger: "blur",
          },
        ],
        court: [
          {
            type: "string",
            required: true,
            message: "请输入法院",
            trigger: "blur",
          },
        ],
        office_name: [
          {
            type: "string",
            required: true,
            message: "请输入律师",
            trigger: "blur",
          },
        ],
        lawyer: [
          {
            type: "string",
            required: true,
            message: "请输入律师",
            trigger: "blur",
          },
        ],
        apply_confirm: [
          {
            type: "boolean",
            required: true,
            message: "请选择申请确认",
            trigger: "blur",
          },
        ],
      },
      searchFormRules: {
        oppo_party: [
          {
            type: "string",
            required: true,
            message: "请输入对方当事人",
            trigger: "blur",
          },
        ],
        party: [
          {
            type: "string",
            required: true,
            message: "请输入当事人",
            trigger: "blur",
          },
        ],
      },
      tableColumns: [
        {
          key: "code",
          title: "存档编号",
          width: "140",
        },
        // {
        //   key: "client",
        //   title: "委托人",
        // },
        {
          key: "party",
          title: "当事人",
        },
        {
          key: "oppo_party",
          title: "对方当事人",
        },
        {
          key: "lawyers",
          title: "律师",
          width: "140",
        },
        // {
        //   key: "reason",
        //   title: "案由/罪名",
        // },
        {
          key: "level",
          title: "审级",
          width: "100",
        },
        {
          key: "open_time",
          title: "开庭时间",
          width: "120",
        },
        {
          key: "current_phase",
          title: "办理进度",
          align: "left",
        },
      ],
      title: "案件",
      case_type: null,
      dialogVisible: false,
      dlgLetterVisible: false,
      dlgIntroVisible: false,
      dlgProgressVisible: false,
      dlgSearchVisible: false,

      dialogType: "new",
      cases: [],
      caseDatas: [],
      //案件进度
      case_id: null,
      case_code: "",
      assist_lawyer: null,
      third_lawyer: null,
      archive_flag: null,
      checkProgressList: [],
      progressList: [],
      orgProgressList: [],
      selProgress: [],
      reasons: [],
      users: [],
      case_types: [
        { id: 1, name: "民事" },
        { id: 2, name: "刑事" },
        { id: 3, name: "行政" },
        { id: 4, name: "刑附民" },
        { id: 5, name: "刑事自诉" },
        { id: 6, name: "仲裁" },
        { id: 7, name: "执行案件" },
      ],

      total: 0,
      listLoading: true,
      progressLoading: true,
      listQuery: {
        page: 1,
        page_size: 20,
        name: null,
        case_type: null,
        search_date: "",
        archive_flag: 0,
        reason: null,
      },
      pickerOptions: {
        shortcuts: [
          {
            text: "最近一周",
            onClick(picker) {
              const end = new Date();
              const start = new Date();
              start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
              picker.$emit("pick", [start, end]);
            },
          },
          {
            text: "最近一个月",
            onClick(picker) {
              const end = new Date();
              const start = new Date();
              start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
              picker.$emit("pick", [start, end]);
            },
          },
          {
            text: "最近三个月",
            onClick(picker) {
              const end = new Date();
              const start = new Date();
              start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
              picker.$emit("pick", [start, end]);
            },
          },
        ],
      },
      fileList: [],
    };
  },
  computed: {
    ...mapGetters(["uid", "is_super", "token"]),
    getTitle() {
      return this.dialogType == "new"
        ? `新增${this.title}`
        : `编辑${this.title}`;
    },
    headerObj() {
      return {
        authorization: "JWT " + this.token,
      };
    },
    uploadData() {
      console.log(this.form.id);
      return {
        case_id: this.form.id,
      };
    },
  },
  components: {
    Pagination,
    Transfer,
  },
  created() {
    this.getCaseList();
    this.getAllReason();
    this.getAllUser();
  },
  methods: {
    handleClear() {
      this.introForm.cert_no = "";
      this.introForm.id_card = "";
      this.introForm.telephone = "";
    },

    handleChange(value) {
      if (value == null || value == undefined || value.length==0) return;
      let users = this.users;
      let arr_values = value.split("、");
      let lawyers = [];
      this.introForm.cert_no = "";
      this.introForm.id_card = "";
      this.introForm.telephone = "";
      arr_values.forEach((item) => {
        users.forEach((user) => {
          if (user.real_name === item) {
            lawyers.push(user);
          }
        });
      });

      lawyers.forEach((item) => {
        this.introForm.cert_no += " " + item.cert_no;
        this.introForm.id_card += " " + item.id_card;
        this.introForm.telephone += " " + item.telephone;
      });
    },

    transferChange(value, direction, movedKeys) {
      console.log("transferChange:", value, direction, movedKeys);
      // this.progressList = this.orgProgressList;
    },
    getCaseList() {
      this.listLoading = true;
      getCases(this.listQuery)
        .then((res) => {
          this.cases = res.results;
          this.listLoading = false;
          this.total = res.count;
        })
        .catch((error) => {
          console.log(error);
          this.$message.error("获取案件信息失败!");
          this.listLoading = false;
        });
    },
    getProgresses(params) {
      this.progressLoading = true;
      getProgressList(params)
        .then((res) => {
          this.progressList = res;
          this.orgProgressList = res;
          this.progressLoading = false;
        })
        .catch((error) => {
          console.log(error.message);
          this.$message.error("获取数据失败");
          this.progressLoading = false;
        });
    },

    getAllReason() {
      getAllReason()
        .then((res) => {
          this.reasons = res.map((item) => {
            return { id: item.id, value: item.name };
          });
        })
        .catch((error) => {
          this.$message.error("读取案由失败!");
        });
    },
    getAllUser() {
      getUserList()
        .then((res) => {
          this.users = res;
        })
        .catch((error) => {
          this.$message.error("读取用户信息失败!");
        });
    },
    //办案进度
    handleProgress(data) {
      this.progressList = [];
      this.selProgress = data.progresses;
      // this.checkProgressList = this.selProgress.map((item) => {
      //   return item.progress;
      // });
      this.checkProgressList = [];
      this.case_id = data.id;
      this.case_code = data.code;
      this.assist_lawyer = data.assist_lawyer;
      this.third_lawyer = data.third_lawyer;
      this.archive_flag = data.archive_flag;
      this.dlgProgressVisible = true;
      const params = {
        case_type: data.case_type,
        case_id: this.case_id,
      };
      this.getProgresses(params);
    },
    deleteProgress({ $index, row }) {
      delCaseProgress(row.id)
        .then((res) => {
          // this.setProgressTime(case_progress.progress, null);
          this.selProgress.splice($index, 1);
        })
        .catch((error) => {
          this.$message.error("删除失败!");
        });
    },
    handleProgressChange(checked, progress_id) {
      //增加
      if (checked) {
        const data = {
          case: this.case_id,
          progress: progress_id,
        };
        addCaseProgress(data)
          .then((res) => {
            this.selProgress.push(res);
          })
          .catch((error) => {
            this.$message.error("添加失败!");
          });
      } else {
        //删除
        // const index = this.selProgress.findIndex(
        //   (v) => v.case === this.case_id && v.progress === progress_id
        // );
        // const case_progress = this.selProgress.splice(index, 1)[0];
        // if (case_progress) {
        //   delCaseProgress(case_progress.id)
        //     .then((res) => {
        //       this.setProgressTime(case_progress.progress, null);
        //     })
        //     .catch((error) => {
        //       this.$message.error("取消失败!");
        //     });
        // }
      }
    },
    setProgressTime(progress, progress_time) {
      const index = this.progressList.findIndex((v) => v.id === progress);
      this.progressList[index].progress_time = progress_time;
    },
    onProgressClose() {
      this.dlgProgressVisible = false;
      this.getCaseList();
    },
    //设置归档
    handleArchive(flag) {
      if (flag) {
        const letters = this.form.letters;
        const letter_count = letters.reduce((c, l) => {
          return c + (l.stamp_confirm != true);
        }, 0);
        if (letter_count > 0) {
          this.form.archive_flag = !flag;
          this.$message.warning("该案件有待确定的律师函,不能归档");
          return;
        }
        if (!this.form.is_final) {
          this.form.archive_flag = !flag;
          this.$message.warning("该案件没有结案,不能归档");
        }
      }
    },
    // 查询
    handleFilter() {
      this.listQuery.page = 1;
      this.getCaseList();
    },

    ///更多功能
    handleCommand(command) {
      let type = command["type"];
      if (type == "letter") {
        this.handleAddLetter(command["row"]);
      } else if (type == "introduce") {
        this.handleAddIntro(command["row"]);
      }
    },

    //增加介绍信
    handleAddIntro(data) {
      this.case_type = data.case_type;
      this.dlgIntroVisible = true;
      this.introForm.case = data.id;
      this.introForm.case_code = data.code;
      this.introForm.party = data.party;
      this.introForm.reason = data.reason;
      this.introForm.court = "";
      let lawyer = data.lead_lawyer_name;
      if (data.assist_lawyer_name && data.assist_lawyer_name.length > 0 && data.lead_lawyer_name != data.assist_lawyer_name) {
        lawyer += "、" + data.assist_lawyer_name;
      }
      this.introForm.lawyer = lawyer;
      this.handleChange(this.introForm.lawyer);
      this.$nextTick(() => {
        this.$refs.introFormRef.clearValidate();
        
      });
    },
    //增加律师函
    handleAddLetter(data) {
      this.case_type = data.case_type;
      this.dlgLetterVisible = true;
      this.letterForm.case = data.id;
      this.letterForm.case_code = data.code;
      this.letterForm.party = data.party;
      this.letterForm.client = data.client;
      this.letterForm.reason = data.reason;
      this.letterForm.level = data.level;
      this.letterForm.case_type = data.case_type;
      this.letterForm.court = "";
      // let lawyer = data.lead_lawyer_name;
      const set = new Set();
      if (data.lead_lawyer_name) {
        set.add(data.lead_lawyer_name);
      }
      if (data.assist_lawyer_name) {
        set.add(data.assist_lawyer_name);
      }
      if (data.third_lawyer_name) {
        set.add(data.third_lawyer_name);
      }
      console.log(set);
      this.letterForm.lawyer = [...set].toString();
      this.$nextTick(() => {
        this.$refs.letterFormRef.clearValidate();
      });
    },
    async handleSaveLetter(flag) {
      this.$refs.letterFormRef.validate(async (valid) => {
        if (!valid) return;

        const apply_confirm = this.letterForm.apply_confirm;
        if (flag === "print") {
          if (apply_confirm == false) {
            this.$message.error("申请确认请选择确定,才能打印");
            return;
          }
        }
        this.letterForm.user = this.uid;
        const res = await addLetter(this.letterForm);
        const { id } = res;

        this.getCaseList();
        const { code, client, party } = res;

        this.dlgLetterVisible = false;

        if (id > 0 && flag == "print") {
          this.$router.push(`/case/civil_print/${id}`);
          return;
        }

        this.$notify({
          title: "Success",
          dangerouslyUseHTMLString: true,
          message: `
            <div>律师函编号: ${code}</div>
              <div>委托人: ${client}</div>
              <div>当事人: ${party}</div>
            `,
          type: "success",
        });
      });
    },

    async handleSaveIntro(flag) {
      this.$refs.introFormRef.validate(async (valid) => {
        if (!valid) return;

        const apply_confirm = this.introForm.apply_confirm;
        if (flag === "print") {
          if (apply_confirm == false) {
            this.$message.error("申请确认请选择确定,才能打印");
            return;
          }
        }
        this.introForm.user = this.uid;
        const res = await addIntroduce(this.introForm);
        const { id } = res;

        this.getCaseList();
        const { code, court, party } = res;

        this.dlgIntroVisible = false;

        if (id > 0 && flag == "print") {
          this.$router.push(`/case/intro_print/${id}`);
          return;
        }

        this.$notify({
          title: "Success",
          dangerouslyUseHTMLString: true,
          message: `
            <div>介绍信编号: ${code}</div>
              <div>针对机关: ${court}</div>
              <div>当事人: ${party}</div>
            `,
          type: "success",
        });
      });
    },
    //关闭对话框
    handleClose() {
      this.fileList = [];
    },
    //打开对话框
    handleOpen() {
      this.$nextTick(() => {
        if (this.form.archive_flag == true) {
          this.$refs.upload.$el.getElementsByClassName("el-upload")[0].style =
            "display:none";
        }
      });
    },
    handleSearch() {
      this.searchForm = Object.assign({}, defSearchForm);
      this.dlgSearchVisible = true;
      this.caseDatas = [];
      this.search = true;
      this.$nextTick(() => {
        this.$refs.searchFormRef.clearValidate();
      });
    },
    onHandleSearch() {
      console.log(this.searchForm);
      this.caseDatas = [];
      this.$refs.searchFormRef.validate((valid) => {
        if (valid) {
          getSearchCases(this.searchForm).then((res) => {
            console.log(res);
            this.caseDatas = res;
            this.search = false;
          });
        } else {
          return false;
        }
      });
    },
    // 增加
    handleAdd() {
      this.form = Object.assign({}, defaultForm);
      this.dialogType = "new";
      this.dialogVisible = true;

      this.$nextTick(() => {
        this.dlgSearchVisible = false;
        this.$refs.formRef.clearValidate();
      });
    },
    // 修改
    handleEdit(scope, flag) {
      this.form = Object.assign({}, scope.row);

      this.dialogType = flag;
      this.dialogVisible = true;
      this.case_type = scope.row.case_type;
      this.fileList = scope.row.files;
      this.$nextTick(() => {
        this.$refs.formRef.clearValidate();
      });
    },
    // 删除
    handleDelete({ $index, row }) {
      this.$confirm("确定要删除该案件吗?", "删除提示：", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(async () => {
          const res = await delCase(row.id);
          this.cases.splice($index, 1);
          this.$message({
            type: "success",
            message: "删除成功!",
          });
        })
        .catch((err) => {
          console.error(err);
        });
    },
    // 保存操作
    async handleSave(flag) {
      this.$refs.formRef.validate(async (valid) => {
        if (!valid) return;

        const isEdit = this.dialogType === "edit";
        if (isEdit) {
          if (!this.form.user) {
            this.form.user = this.uid;
          }
          const res = await updateCase(this.form);
          const index = this.cases.findIndex((v) => v.id === res.id);
          this.cases.splice(index, 1, res);
        } else {
          this.form.user = this.uid;
          const res = await addCase(this.form);
          const { id } = res;
          if (id > 0) {
            this.cases.unshift(res);
          }
        }

        const { client, party, telephone } = this.form;
        if (flag) {
          this.form = Object.assign({}, defaultForm);
        } else {
          this.dialogVisible = false;
        }

        this.$notify({
          title: "Success",
          dangerouslyUseHTMLString: true,
          message: `
              <div>委托人: ${client}</div>
              <div>当事人: ${party}</div>
              <div>电话: ${telephone}</div>
            `,
          type: "success",
        });
      });
    },

    handlePrint(data) {
      this.$router.push(`/case/civil_print/${data.id}`);
    },
    caseTypeChange(value) {
      // console.log(value);
      this.case_type = value;
      if (value == 2) {
        this.form.register_time = null;
        this.form.oppo_party = "";
      }
    },
    dataFormatter(row, column, cellValue, index) {
      if (column.property == "apply_time") {
        return formatDateTime(cellValue);
      } else if (column.property == "stamp_time") {
        return formatDateTime(cellValue);
      } else if (column.property == "add_time") {
        return formatDateTime(cellValue, "YYYY-MM-DD");
      } else {
        return cellValue;
      }
    },
    querySearch(queryString, cb) {
      if (this.form.case_type == 3 || this.form.case_type == 6) {
        cb([]);
        return;
      }
      var reasons = this.reasons;
      console.log(queryString);
      var results = queryString
        ? reasons.filter(this.createFilter(queryString))
        : reasons;
      // 调用 callback 返回建议列表的数据
      cb(results);
    },
    createFilter(queryString) {
      return (reason) => {
        return (
          reason.value.toLowerCase().indexOf(queryString.toLowerCase()) >= 0
        );
      };
    },
    handleSelect(item) {
      console.log(item.value);
      // this.form.reason = item.value
    },
    //文件上传
    handleRemove(file, fileList) {
      console.log(file, fileList);
      this.fileList = fileList;
      var file_id = null;
      file_id = file.id;
      if (file_id == null) {
        if (file.response.status_code == 200) {
          file_id = file.response.file.id;
        }
      }

      if (file_id == null) return;

      delCaseFile(file_id)
        .then((res) => {
          const index = this.form.files.findIndex((item) => item.id == file_id);
          if (index > -1) {
            this.form.files.splice(index, 1);
          }
          this.$message.success("删除成功");
        })
        .catch((error) => {
          this.$message.error("删除失败");
        });
    },
    handlePreview(file) {
      if (file.file) {
        window.open(file.file);
      }
    },
    submitUpload() {
      this.$refs.upload.submit();
    },
    handleSuccess(res, file, filelist) {
      console.log("success:", file, filelist);
      this.fileList = filelist;
      if (res.status_code == 200) {
        file["file"] = file.response.file.file;
        this.form.files.push(file.response.file);
        this.$message.success(res.file.name + "上传成功");
      } else {
        this.$message.error("上传失败");
      }
    },
    //上传前
    handleBeforeUpload(file) {
      // console.log(file.type);
      const flag = file.size / 1024 / 1024 < 10;
      if (!flag) {
        this.$message.error("上传文件大小不能超过 10MB!");
      }
      return flag;
    },
    onConfirmChange(row) {
      console.log(row);
      const data = {
        id: row.id,
        confirm: row.confirm,
      };
      updateCaseProgress(data)
        .then((res) => {
          console.log(res);
        })
        .catch((error) => {
          console.log(error);
        });
    },
  },
};
</script>

<style lang='scss' scoped>
.app-container {
  .el-dropdown {
    margin-left: 10px;
  }
  .dialog-inner {
    width: 90%;
    padding: 0 30px;
    .inner-item {
      padding-bottom: 15px;
      padding-left: 10px;
    }
  }
  ::v-deep .el-dialog .el-table thead {
    color: #409eff;
    font-weight: 500;
    font-size: 14px;
  }
  .el-autocomplete {
    width: 100%;
  }
}
</style>